package com.frejoys.common.exception;

import com.frejoys.common.error.HttpStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义返回异常信息结构
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class GeneralException extends RuntimeException {

    private Integer code;

    private Object data;

    public GeneralException(Integer code) {
        // super(msg);
        super("");
        this.code = code;
    }

    public GeneralException(HttpStatus httpStatus) {
        // super(httpStatus.getMsg());
        super("");
        this.code = httpStatus.getCode();
    }

    public GeneralException(HttpStatus httpStatus, Object data) {
        // super(httpStatus.getMsg());
        super("");
        this.code = httpStatus.getCode();
        this.data = data;
    }

}
